package com.song.sparkstudy;

import java.util.ArrayList;
import java.util.List;

import org.apache.spark.SparkConf;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;

public class JavaHdfsSaveTest {
	
	
	
	
	public static void main(String[] args) {
		SparkConf conf = new SparkConf().setAppName("hdfssave");
		JavaSparkContext context = new JavaSparkContext(conf);
		List<String> lines = new ArrayList<String>(){
			{
				add("hello word1");
				add("hello word2");
				add("hello word3");
				add("hello word4");
				add("hello word5");
				add("hello word6");
			}
		};	
		
	JavaRDD<String> linerdd = context.parallelize(lines);
//	linerdd.saveAsTextFile("hdfs://song-dinfo:9000/sparkdata");
	JavaRDD<String> readrdd = context.textFile("hdfs://song-dinfo:9000/sparkdata");
	for(String test :readrdd.collect() )
	{
		System.out.println(test);
	}
	context.close();
		
	}
}
